const mysql = require('../lib/mysql');
const Servers = require('../lib/server');
const sql = new Servers('uu_account');
class Account {
  /**
   * 新增用户
   * @param {object} obj 
   */
  static insertUser(obj) {
    return sql.insert(obj);
  }
  /**
   * 用户是否存在
   * @param {object} obj 
   */
  static isExist(obj) {
    return sql.find(obj);
  }
  /**
   * 根据用户名和密码获取用户
   * @param {object} obj
   */
  static getUser(name, password) {
    const sql = 'SELECT * FROM uu_account WHERE user_name=? AND user_password=?';
    return mysql.sql(sql, [name, password], 'select');
  }
}

module.exports = Account;